/**
 * Created by vincent on 2017/9/27.
 */
moduleQuiz.controller('EditQuiz', function ($$CambioConfig, $scope, $log, LoadingService, DialogService, GaugeResource, EnumService) {
    initPage($scope);
    $scope.$on("ngDialog.opened", function () {
        dialogOnLoad();
    });

    $scope.cancel = function () {
        DialogService.close();
    };

    $scope.submit = function () {
        if ($scope.editGForm.$valid) {
            //LoadingService.show();
            Alert.confirm(function () {
                GaugeResource.update($scope.editingGauge, function (gaugeResult) {
                    $log.debug("量表基本信息更新结果", gaugeResult);
                    angular.copy(gaugeResult, $scope.currentGauge);
                    DialogService.close();
                    Alert.success();
                    //LoadingService.hide();
                }, function () {
                    //LoadingService.hide();
                });
            })
        }
    };

});